<{include file="public/header.html"}> 
<script type='text/javascript'>var type="hot";</script>
	<!--问答 首页-->
	<header class="title-fixed w100">
		<div class="title bj-white">
			<a href="/" class="title-top title-left"><img src="<{$style_dir}>/img/logo.png" style="width: 40px;"/></a>
			<div class="login-head title-right">
                        <{if !$uinfo}>
                        <a href="<{eval url('account/login')}>" class=" title-right title-btn i-title">登录</a>
                        <{else}>
                        <a href="<{eval url('account')}>" class="i-title head">
                            <img src="<{$uinfo['head_img']}>"/>
                        </a>
                        <{/if}>
			</div>
            <div class="wd-search fr f-cb">
                <input class="fl" type="text" id="search-text" value="<{$search_word}>" readonly="readonly" placeholder="搜索相关问答" data-search-val="<{$keyword}>" oninput="if(value.length>8)value=value.slice(0,8)"/>
                <button class="iconfont" id="wenda-search-btn">&#xe613;</button>
			</div>
		</div>
	</header>
	<div class="wd-index">
		<a href="<{eval url('wenda/asking')}>" class="wd-ask">提问</a>
		<!--banner-->
		<div class="banner mt50">
			<a href="http://wx.tan66.com/wenda/24277.html"><img src="<{$style_dir}>/img/banner2.jpg"/></a>
		</div>
                <div class="mb60">
                	<!--选项卡-->
                        <div class="wd-tab f-cb mt20 wenda-nav" id="wrapper">
                            <ul>
                                <li class="active" data-type="hot">
                                    <div class="text text-center">
                                        <p class="mt10">热门问题</p>
                                        <b></b>
                                    </div>
                                    <span style="height:45px;"></span>
                                    <img src="<{$style_dir}>/img/wenda/tab-2.jpg"/>
                                </li>
                                <li data-type="lastest">
                                    <div class="text text-center">
                                        <p class="mt10">最新问题</p>
                                        <b></b>
                                    </div>
                                    <span></span>
                                    <img src="<{$style_dir}>/img/wenda/tab-1.jpg"/>
                                </li>
                                <li data-type="wait">
                                    <div class="text text-center">
                                        <p class="mt10">待回答问题</p>
                                        <b></b>
                                    </div>
                                    <span></span>
                                    <img src="<{$style_dir}>/img/wenda/tab-3.jpg"/>
                                </li>
                                <li data-type="act">
                                    <div class="text text-center">
                                        <p class="mt10">在线活动</p>
                                        <b></b>
                                    </div>
                                    <span></span>
                                    <img src="<{$style_dir}>/img/wenda/tab-4.jpg"/>
                                </li>
                            </ul>
                	</div>
                    <!--问答首页列表-->
                    <ul class="wd-problem-list" id='content-list'>
                        <{foreach from=$list item=val}>
                        <li class="border-bottom-lg" >
                            <a href="<{$val['detail_url']}>">
                                        <p class="problem-title border-bottom-sm ptb15 plr15"><{$val['title']}></p>
                                        <div class="pt10 f-cb plr15">
                                            <{if $val['answer']}>
                                                <{if $val['answer']['thumb']}>
                                                <div class="problem-img fl">
                                                        <img src="<{$val['answer']['thumb']}>"/>
                                                </div>
                                                <p class="problem-text pl105"><{if $val['answer']['is_answer']}>最佳答案:<{/if}><{$val['answer']['content']}></p>
                                                <{else}>
                                                <p class="problem-text"><{$val['answer']['content']}></p>
                                                <{/if}>
                                            <{else}>
                                            <p class="problem-text"><{$val['summary']}></p>
                                            <{/if}>
                                        </div>
                                        <div class="user-head ptb5 plr15 f-cb">
                                                <div class="fl">
                                                        <img src="<{$val['head_img']}>" class="head fl"/>
                                                        <span class="name fl ml5"><{$val['nickname']}></span>
                                                        <img src="<{$style_dir}>/img/vip/vip1.png" class="badge fl ml5"/>
                                                </div>
                                                <font class="iconfont fr ml10 mt5"><i><{$val['answernum']}></i>&#xe675;</font>
                                                <font class="iconfont fr ml10 mt5"><i><{$val['focusnum']}></i>&#xe950;</font>
                                                <font class="iconfont fr mt5"><i><{$val['readnum']}></i>&#xe60a;</font>
                                        </div>
                                </a>
                        </li>
                        <{/foreach}>
                    </ul>
                    <div class="loading" id="noresults" <{if $list}>style="display: none;"<{/if}>>
                        <a href="javascript:;" class="load-success empty-follow-data">没有任何数据哦</a>
                    </div>
                    <div class="loading" id="loading" style="display: none;">
                        <a class="/*pull-load*/ load-success" href="javascript:;">加载中...</a>
                    </div>
                    <div class="loading" id="nomoreresults" style="display: none;">
                        <a href="javascript:;" class="load-success nomore-load">已经到底啦~~~</a>
                    </div>
                </div>
	</div>
        <{include file="public/footer_login.html"}> 
	<!--底部悬浮-->
        <{include file="public/footer_banner.html"}> 	
        <script type="text/javascript" src="/static/js/iscroll/iscroll.js"></script>
        <script type="text/javascript" src="/static/js/scrollpagination.js"></script>
        <script type="text/javascript" src="/static/js/wenda-min-1.0.js"></script>
        <script type="text/javascript">
            
            var scrollPagination_obj = null;
            $(function(){
                var Scroll = new iScroll('wrapper',{hScrollbar:false, vScrollbar:false});
                $('#content-list').scrollPagination({
                    'contentPage': "/ajax/ajax_fetch_more_wenda_json",
                    'contentData': {
                        'pageIndex': WD_CIG.pageIndex,
                        'dType': WD_CIG.dtype,
                    },
                    'scrollTarget': $(window),
                    'heightOffset': 0,
                    'initLoad':function(){
                        scrollPagination_obj = this;
                    },
                    'beforeLoad': function() { // before load function, you can display a preloader div
                        $('#loading').fadeIn('fast');
                        $('#loading').attr('scrollpagination','disabled');
                    },
                    'afterLoad': function(elementsLoaded) { // after loading content, you can use this function to animate your new elements
                        $('#loading').fadeOut('fast');
                        $('#loading').attr('scrollpagination','enabled');
                        if (elementsLoaded.length == 0) {
                            $('#nomoreresults').fadeIn('slow');
                            $('#content-list').stopScrollPagination();
                        }else{
                            WD_CIG.pageIndex = WD_CIG.pageIndex + 1;
                        }
                        this.contentData.pageIndex = WD_CIG.pageIndex;
                        $(elementsLoaded).fadeInWithDelay();

                        if ($('#content-list').children().length > 100) { // if more than 100 results already loaded, then stop pagination (only for testing)
                            $('#nomoreresults').fadeIn();
                            $('#content-list').stopScrollPagination();
                        };
                    }
                });     
                $.fn.fadeInWithDelay = function() {
                    var delay = 0;
                    return this.each(function() {
                        $(this).delay(delay).animate({
                            opacity: 1
                        }, 200);
                        delay += 100;
                    });
                };
                
                $("#wenda-search-btn,#search-text").on("click",function(){
                    var _box = $("#search-text"),_text=_box.val();
                    window.location.href = "/wenda/search.html?kw="+encodeURIComponent(_text);
                });
            });
        </script>
<{include file="public/footer.html"}> 